import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'
import createPersistedState from "vuex-persistedstate";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    collectlist:[]
  },
  getters: {
  },
  mutations: {
    collect(state,payload){
      state.collectlist.push( payload );
    },
    cancel_collect(state,payload){
      var index = state.collectlist.findIndex((item)=>{
        return item.mtWmPoiId == payload.mtWmPoiId;
      })
      if( index != -1 ){
        state.collectlist.splice(index,1);
      }
    },
  },
  actions: {
    request_favlist(){
      var userid=JSON.parse(localStorage.getItem('userinfo')).id;
    }
  },
  modules: { 
    
  },
  plugins:[ createLogger(),createPersistedState() ]
})
